package com.hs.test.cicd;

import com.hs.framework.BaseTest;
import org.junit.jupiter.api.*;
import org.junit.jupiter.api.parallel.Execution;
import org.junit.jupiter.api.parallel.ExecutionMode;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.ValueSource;

import java.io.File;
import java.util.Map;

@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
@Execution(ExecutionMode.SAME_THREAD)
public class AndroidSampleApp1HeadspinRep extends BaseTest {

    @Order(1)
    @ParameterizedTest
    @ValueSource(strings = {appPackage})
    public void ClearAppFromHeadspinRepo(String identifier) throws Exception {
        boolean ret = hsAPI.clearUploadedAppByIdentifier(identifier);
        Assertions.assertTrue(ret);
    }

    @Order(2)
    @Test
    public void uploadApkToHeadspinRepo() throws Exception {
        String fileFullPath = System.getenv("app_store_path") + File.separator + androidBuildCommit;
        Map<String, Object> ret = hsAPI.uploadAppToHeadspinRepo(fileFullPath);
        Assertions.assertEquals(200, ret.get("code"));
    }
}


